<template>
	<view>
		<view class="list">
			<view class="item" v-for="(item,index) in gridList" :key="index" @tap.stop="navTo(item)">
				<image class="images" :src="item.avatar" mode=""></image>
				<view class="username">
					{{item.nickname || item.username}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import list from '../../common/new.js'
	export default {
		data() {
			return {
				gridList: [],
				id: ''
			}
		},
		onLoad(optins) {
			this.id = optins.id
			uni.setNavigationBarTitle({
				title: list[optins.id].title || '类别'
			})
			this.getFuns()
		},
		methods: {
			getFuns() {
				var that = this
				uniCloud.callFunction({
					name: "type",
					data: {
						action: "getList",
						params: {
							id: that.id,
						}
					}
				}).then((res) => {
					if (res.result) {
						that.gridList = res.result
					}
				})
			},
			navTo(item) {
				uni.navigateTo({
					url: '/bbs/topic/his?id=' + item._id
				})
			}
		}
	}
</script>

<style>
	.item {
		display: flex;
		/* justify-content: space-between; */
		margin: 20upx;
		align-items: center;
	}

	.images {
		height: 100upx;
		width: 100upx;
		border-radius: 50upx;
	}

	.username {
		margin-left: 50upx;
	}
</style>
